const redis = require("redis")
const conf = require("../../conf/redis")
const client = redis.createClient({
    host:conf.host,
    port:conf.port,
    auth:conf.auth,
    db:conf.db 
})

let rdb = () => {
    return new Promise((resolve,reject) => {
        client.on("error",(err)=>{
            if(!err){
                reject(err)
            }
        })
        client.on("connect",()=>{
            resolve(client)
        })
    })
}

module.exports = rdb()